package com.yxch.admin.controller.home;

import com.yxch.admin.model.home.TeacherTeam;
import com.yxch.admin.service.home.HomeService;
import com.yxch.admin.utils.ResultAPI;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@Slf4j
@RequestMapping("/yxch/admin/home")
public class TeachTeamController {
    @Autowired
    private HomeService homeService;


    /**
     * 获取教师团队
     *
     * @param courseId
     * @return
     */
    @GetMapping("/team")
    public ResultAPI getTeam(@RequestParam Integer courseId) {
        return homeService.getTeam(courseId);
    }


    /**
     * 批量删除老师
     *
     * @param ids
     * @return
     */
    @DeleteMapping("/team/{ids}")
    public ResultAPI deleteTeamTeachers(@PathVariable List<Integer> ids) {
        return homeService.deleteTeamTeachers(ids);
    }

    /**
     * 添加老师
     *
     * @param teacherTeam
     * @return
     */
    @PostMapping("/team")
    public ResultAPI addandUpdateTeamTeacher(@RequestBody TeacherTeam teacherTeam) {
        return homeService.addandUpdateTeamTeacher(teacherTeam);
    }
}
